<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAssetStocksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('asset_stocks', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('product_model_number')->nullable();
            $table->text('description')->nullable();
            $table->integer('init_quantity')->default(0);
            $table->integer('available_quantity')->default(0);
            $table->integer('total_quantity')->default(0);
            $table->integer('checkout_quantity')->default(0);
            $table->double("marking_price_per_unit")->default(0.00);
            $table->double("bid_price_per_unit")->default(0.00);
            $table->unsignedBigInteger("category_id")->nullable();
            $table->unsignedBigInteger("sub_category_id")->nullable();
            $table->unsignedInteger('affiliation_id')->comment("归属");
            $table->unsignedBigInteger("brand_id")->nullable();
            $table->unsignedInteger("keeper_id")->comment("保管人");
            $table->unsignedBigInteger("location_id")->nullable();
            $table->unsignedBigInteger("vendor_id")->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('asset_stocks');
    }
}
